class MachineOperator(val name:String){
    fun checkin() = checkedIn++
    fun checkout() = checkedIn--

    companion object {
        var checkedIn = 0
        fun minBreak() = "150 mins every 2 hours"
    }
}
println(MachineOperator.checkedIn)
println(MachineOperator.minBreak())

val machineOperator = MachineOperator("A")
machineOperator.checkin()
println(machineOperator.name)
println(machineOperator.checkin())
println(machineOperator.checkin())
println(machineOperator.checkin())
println(machineOperator.checkout())
println(machineOperator.checkout())
println(machineOperator.checkout())
println(machineOperator.checkout())

val comp = MachineOperator.Companion
println(comp.minBreak())
println(comp.checkedIn)

class NamedMachine(){
    companion object nameCompanion{
        val name = "nameCompanion"
    }
}
val namedComp =  NamedMachine.nameCompanion
println(namedComp.name)

